//调用后端的接口
import request from '@/utils/request'

export function getStudents(){
    return request({
        url: '/SSMdemo1_war_exploded/getStudents',      //后端接口，显示学生列表
        method: 'get',
        
      })
}
//根据学号、班级和系别进行动态查询
export function searchStudent(data) {
    return request({
        method: 'post',
        url: '/SSMdemo1_war_exploded/searchStudent',
        headers: {
            'Content-Type': 'application/json'
        },
        data            //data属性是post方式提交请求时携带的参数 1、参数a  data:a 2、参数data  写成:data,相当于data:data
    })
}
//添加学生
export function addStudent(b) {
    return request({
        method: 'post',
        url: '/SSMdemo1_war_exploded/addStudent',
        headers: {
            'Content-Type': 'application/json'
        },
        data: b,
    })
}
//根据ID删除学生
export function deleteStudentById(stuid) {
    return request({        //config
        method: 'delete',
        url: '/SSMdemo1_war_exploded/delStudent?stuid=' + encodeURIComponent(stuid)
    })
}
//批量删除学生
export function delStudentByIds(data) {
    return request({
        method: 'post',
        url: '/SSMdemo1_war_exploded/delStudentByIds',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    })
}
//对student表进行单个信息修改
export function updateStudent(a) {
    return request({
        method: 'post',
        url: 'http://localhost:8080/SSMdemo1_war_exploded/updateStudent',
        headers: {
            'Content-Type': 'application/json'
        },
        data: JSON.stringify(a),
    })
}